/*-------------------------------------------------------------------------
 * CLR版本:     4.0.30319.42000
 * 创建人:      song
 * 创建时间：   2024/4/9 17:56:20
 * 功 能：      吸收 绘制器
 *-------------------------------------------------------------------------*/

#if UNITY_EDITOR
namespace SCore.Editor.SShaderDraw
{
    using System.Collections.Generic;
    using UnityEditor;
    using UnityEngine;

    public class SVortexProGUI : SComponentGUIBase
    {
        SToggleProp _VortexAbsorption;
        SVectorProp _MinMax, _ObjectCenterOffset, _TargetPos;
        SRangeProp _Percent;
        SFloatProp _Stretch, _RotateAngle;


        public SVortexProGUI(MaterialEditor materialEditor, Dictionary<string, MaterialProperty> dics) : base(
            materialEditor, dics)
        {
            _VortexAbsorption = new SToggleProp("_VortexAbsorption", Styles.VortexAbsorption, materialEditor, dics, 0f,
                SShaderEditorHelpr.GetInternelStyle("BoldTextField"));
            _MinMax = new SVectorProp("_MinMax", Styles.MinMax, materialEditor, dics, new Vector4(-1, 1, 0, 0));
            _ObjectCenterOffset = new SVectorProp("_ObjectCenterOffset", Styles.ObjectCenterOffset, materialEditor,
                dics, Vector4.zero);
            _TargetPos = new SVectorProp("_TargetPos", Styles.TargetPos, materialEditor, dics, Vector4.one);
            _Percent = new SRangeProp("_Percent", Styles.Percent, materialEditor, dics, 0f, 0f, 1f);
            _Stretch = new SFloatProp("_Stretch", Styles.Stretch, materialEditor, dics, 1f);
            _RotateAngle = new SFloatProp("_RotateAngle", Styles.RotateAngle, materialEditor, dics, 0f);
        }

        public override void Changed()
        {
        }

        public override void DrawProperties()
        {
            if (_VortexAbsorption.Exist)
            {
                GUILayout.BeginVertical("box");
                base.DrawPartTitle(_VortexAbsorption, Styles.VortexAbsorption, 15f, this.lProps.ToArray());
                GUILayout.EndVertical();
            }
        }

        public override void RefreshProperties()
        {
            this.lProps.Clear();
            this.lProps.Add(_MinMax);
            this.lProps.Add(_ObjectCenterOffset);
            this.lProps.Add(_TargetPos);
            this.lProps.Add(_Percent);
            this.lProps.Add(_Stretch);
            this.lProps.Add(_RotateAngle);
        }

        private class Styles
        {
            public static GUIContent VortexAbsorption = new GUIContent("吸收", "吸收模块");
            public static GUIContent MinMax = new GUIContent("吸收的范围", "模型空间离中心点的多少距离会被吸收");
            public static GUIContent ObjectCenterOffset = new GUIContent("模型中心点偏移", "模型中心点便宜");
            public static GUIContent TargetPos = new GUIContent("吸收目标点", "模型空间下的吸收目标点");
            public static GUIContent Percent = new GUIContent("吸收进度", "吸收进度");
            public static GUIContent Stretch = new GUIContent("吸收强度", "吸收强度");
            public static GUIContent RotateAngle = new GUIContent("吸收旋转角度", "吸收旋转角度");
        }
    }
}
#endif